#ifndef _BSP_PARAM_H
#define _BSP_PARAM_H
#include <stdio.h>
#include <string.h>

#define FIRMWARE_VERSION "0_official_V1.0.1"
#define OTA_FIRMWARE_VERSION "V1.0.1"
#define VERTYPE "official"
#define HWVER   "A"

/* MQTT连接 */
enum{
    MQTT_DISCONNECT = 0, 
    MQTT_APP_DISCONNECT = 0,
    MQTT_CONNECT = 1,
    MQTT_APP_CONNECT = 1,
    MQTT_CONNECT_PRIORITY_H = 2,
};

/* BLUFI连接 */
enum{
    BLUFI_BLE_DISCONNECT = 0,
    BLUFI_BLE_CONNECT = 1,
    BLE_CONNECT_PRIORITY_H = 2,
};

/* wifi连接 */
enum{
    WIFI_DISCONNECT = 0,
    WIFI_CONNECT = 1,
};
/* 系统状态 */
enum{
    SYS_IDLE = 0,
    SYS_STOP = 0,
    SYS_RUN_NORMAL,
    SYS_PAUSE,
    SYS_STATUS_MAX,

};
/* 发送状态 */
enum{
    SEND_STATUS_STOP = 0,
    SEND_STATUS_RUN,
    SEND_STATUS_PAUSE,
};

/* 设置参数种类 */
enum{
    // MODE_VOICE = 0,
    MODE_TIME  = 0,
    MODE_DLMS,
    MODE_DLQD,
    MODE_DLPL,
    MODE_CCQD,
    MODE_CZFD,
    MODE_CZPL,
    MODE_MAX,
};

/* 参数种类强度 */
enum{
    POWER_0 = 0,
    MODE_DLMS_1 = 1,
    POWER_1 = 1,
    POWER_2 = 2,
    MODE_DLMS_2 = 2,
    POWER_3 = 3,
    MODE_DLMS_3 = 3,
    POWER_4 = 4,
    MODE_DLMS_4 = 4,
    POWER_5 = 5,
    POWER_6 = 6,
    POWER_7 = 7,
    POWER_8 = 8,
    POWER_9 = 9,
    POWER_MAX,
};

/* 声音 */
enum{
    MUSIC_CLOSE = 0,
    MUSIC_OPEN = 1,
    MUSIC_VOICE1 = 1,
    MUSIC_VOICE2,
    MUSIC_VOICE3,
    MUSIC_VOLUME_MAX,
};

enum{
    FLASH_OFF = 0,     // 闪烁——关灯
    FLASH_ON,          // 闪烁-开灯
};


enum{
    GRID1 = 0x00,
    GRID2,
    GRID3,
    GRID4,
    GRID5,
    GRID6,
    GRID7,
    GRID8,
    GRID9,
    GRID10,
    GRID11,
    GRID12,
    GRID_MAX,
};


/* 错误类型 */
enum{
    ERROR_TYPE_NO_ERROR = 0,
    ERROR_TYPE_ELEC_BREAK = 1,
    ERROR_TYPE_CL_BREAK = 2,
};

/* 发送mqtt 对象 */
enum{
    /* D2S */
    MQTT_SEND_D2S_QD = 0,   // 签到
    MQTT_SEND_D2S_GJ,       // 固件版本获取
    MQTT_SEND_D2S_ACK,      // 应答
    /* D2U */
    MQTT_SEND_D2U_ZT,       // 状态上报
    MQTT_SEND_D2U_ACK,      // ACK
    MQTT_SEND_D2U_OTA,      // OTA状态上报

};

/* ota */
enum{
    OTA_IDLE = 0, 
    OTA_REC_REQ = 1,
    OTA_START,
    OTA_SUCCESS,
    OTA_FAIL,
};

typedef struct  
{
    uint8_t sys_status;                             // 系统状态
    uint8_t sys_pointer_index;
    uint8_t sys_vol_switch;                         // 音量开关
    uint8_t sys_error_type;                         // 错误码
    uint16_t sys_countdown;                         // 倒计时s
    uint16_t sys_mode_type_buffer[MODE_MAX];        // 各个模式强度表
    uint8_t ifappmqttconnect;       // 手机app是否发送START 表示app也连接上mqtt
    uint8_t ifwificonnect;
    uint8_t ifblufibleconnect;      // 手机app是否连接blufi ble蓝牙
}sys_main_param_t;


typedef struct  
{   
    uint8_t send_status;                // 运行状态
    uint8_t send_emode;                 // 工作模式
    uint8_t send_este;                  // 电疗强度
    uint8_t send_ehz;                   // 电疗频率
    uint8_t send_mste;                  // 磁疗强度
    uint8_t send_mamp;                  // 磁疗振幅
    uint8_t send_mhz;                   // 磁疗频率
    uint8_t send_vol;                   // 音量大小
    uint8_t send_music;                   // 音量开关
    uint16_t send_runtime;              // 设定时间
    uint16_t send_countdown;            // 倒计时时间
    uint8_t send_error_type;            // 错误码
}send_param_t;









extern uint8_t ota_req_flag;
extern char ota_firm_ver_url[100];

extern void* Get_sys_param_pos(void);
extern void* Get_send_param_pos(void);

// extern sys_main_param_t sys_main_param;





#endif


